"""工具函数"""
import string, secrets

def genkey(length: int=64) -> str:
    """
    生成指定长度的随机字符串
    :param length: 生成的字符串的长度
    :return: 字符串
    """
    characters = string.ascii_letters        # 26个小写字母和26个大写字母
    characters = characters + string.digits  # 10个数字
    characters = characters + '!@#$%^&*./-' # 特殊符号
    return "".join(secrets.choice(characters) for i in range(length))


if __name__ == '__main__':

    """生成指定长度的随机字符串"""
    print(genkey())
    print(genkey(64))